﻿using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Bymed.SpineScan.DataModel;

namespace Bymed.SpineScan.Repository.EntityFramework.Mapping
{
    public class AttendingDoctorMap : EntityTypeConfiguration<AttendingDoctor>
    {
        public AttendingDoctorMap()
        {
            // Primary Key
            this.HasKey(t => t.DoctorTimestamp);

            // Properties
            this.Property(t => t.DoctorTimestamp)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("AttendingDoctor");
            this.Property(t => t.DoctorTimestamp).HasColumnName("DoctorTimestamp");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.OrderIndex).HasColumnName("OrderIndex");
        }
    }
}
